package com.test.mchelepesa.util_rice.data.bean

import android.content.Context
import com.google.gson.Gson
import com.test.mchelepesa.util_rice.data.util.StorageUtil_rice
import com.test.mchelepesa.util_rice.data.util.gzipString

class StorageInfo_rice(val context: Context) {

    fun fetch(): String? {
        return try {
            val data = hashMapOf<String, Any>().apply {
                put("imei", "")
                put("containSd", StorageUtil_rice.gContainSD())
                put("ramCanUse", StorageUtil_rice.gRamCanUse(context))
                put("ramTotal", StorageUtil_rice.gRamTotal(context))
                put("cashCanUse", StorageUtil_rice.gCashCanUse())
                put("cashTotal", StorageUtil_rice.gCashTotal())
                put("extraSD", StorageUtil_rice.gExtraSD())
                put("internalTotal", StorageUtil_rice.gTotalInternalStoreSize(context))
                put("internalAvailable", StorageUtil_rice.gAvailaInternalStoreSize(context))
                put("ramDidUsed", StorageUtil_rice.gRamDidUsed(context))
                put("cashDidUsed", StorageUtil_rice.gCashDidUsed())
                put("sdCardTotal", StorageUtil_rice.gSDCardTotal())
            }
            Gson().toJson(data).trim().gzipString()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}